package station.VisualComponents;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.InputStreamReader;

import station.GUI.MainForm;

public class CameraConnectionListener extends Thread {
//	private MainForm mainForm = null; 
	private boolean shouldStop = false;
	private BufferedReader in = null;
//	private IContainer c;

	@Override
	public void run() {
		while (!shouldStop){
			String line;
			try {
				line = in.readLine();
				System.out.println(line);
				
//				byte[] buffer = new byte[1024];
//				int howmuch = in.read(buffer);
//				for(int x = 0; x < howmuch; x++){
//					System.out.println(buffer[x]);
//				}
			} catch (Exception e) {
			}
		}
	}

	public void setShouldStop(){
		shouldStop = true;
	}
	
	public void setMainForm(MainForm mainForm) {
//		this.mainForm = mainForm;
	}
	
	public void setIn(DataInputStream in) {
		this.in = new BufferedReader(new InputStreamReader(in));
		//IContainerFormat format = IContainerFormat.make();
		//format.
//		c = IContainer.make();
//		c.open(in,null);
//		IMediaReader r = ToolFactory.makeReader(c);
//		IMediaViewer v = ToolFactory.makeViewer();
//		r.addListener(v);
//		while(r.readPacket() == null){
//			
//		}
	}
}
